package util;

/**
 * Created by Волков Олег on 02.07.14.
 */
public class Preconditions {

    public static <T> void notNull(T object){
        if(object == null){
            throw new IllegalAccessError();
        }
    }


    public static <T> void notNull(T...objects){
        for(T object:objects){
            if(object == null) {
                throw new IllegalArgumentException();
            }
        }
    }

    public static void notNull(String s){
        if(s == null || s.trim().equals("")){
            throw new IllegalArgumentException();
        }
    }

    public static void notBlank(String...ss){
        for(String s:ss){
            if(s == null || s.trim().equals("")){
                throw new IllegalArgumentException();
            }
        }
    }

    public static void isTrue(boolean expression){
        if (!expression){
            throw new IllegalArgumentException();
        }
    }
}
